<!DOCTYPE html>
<html>
	<meta charset="UTF-8">

	<head>
		<title>分别用marquee和div+js实现首尾相连循环滚动效果</title>
	</head>

	<body>
		用marquee实现首尾相连循环滚动效果（仅IE）：<br /><br />
		<MARQUEE behavior="scroll" contenteditable="true" onstart="this.firstChild.innerHTML+=this.firstChild.innerHTML;" scrollamount="3" width="100">
			<SPAN unselectable="on">这里是要滚动的内容</SPAN>
		</MARQUEE>
		<br /><br />用DIV+javascript实现首尾相连循环滚动效果（兼容firefox）：<br /><br />
		<DIV id="scrollobj" style="white-space:nowrap;overflow:hidden;width:500px;"><span>这里是要滚动的内容</span></DIV>
		<script language="javascript" type="text/javascript">
			<!--  
			function scroll(obj) {
				var tmp = (obj.scrollLeft) ++;
				//当滚动条到达右边顶端时  
				if(obj.scrollLeft == tmp) obj.innerHTML += obj.innerHTML;
				//当滚动条滚动了初始内容的宽度时滚动条回到最左端  
				if(obj.scrollLeft >= obj.firstChild.offsetWidth) obj.scrollLeft = 0;
			}
			setInterval("scroll(document.getElementById('scrollobj'))", 20);
			//-->
		</script>
	</body>

</html>